#include "stdafx.h"
#include "CameraFPS.h"

using namespace MomogenkyouSystem;
using namespace MomogenkyouHelper;

CameraFPS::CameraFPS()
:Camera()
{

}

CameraFPS::~CameraFPS()
{

}

void	CameraFPS::Update(const float & Interval)
{
	float	_fMoveSpeed =	Interval * 60.0f;
	float4	_vMove		=	FLOAT4_ZERO;	

	if(InputSystem::KeyDown(DIK_LSHIFT))
		_fMoveSpeed *= 0.5f;

	if(InputSystem::KeyDown(DIK_W))
		_vMove = m_vFront * _fMoveSpeed;

	if(InputSystem::KeyDown(DIK_S))
		_vMove = -m_vFront * _fMoveSpeed;
	
	if(InputSystem::KeyDown(DIK_A))
		_vMove = m_vRight * _fMoveSpeed;

	if(InputSystem::KeyDown(DIK_D))
		_vMove = -m_vRight * _fMoveSpeed;

	D3DXVec3Add((float3 *)&m_vPosition, (float3 *)&m_vPosition, (float3 *)&_vMove);
	D3DXVec3Add((float3 *)&m_vLook,		(float3 *)&m_vLook,		(float3 *)&_vMove);
	
	m_vLook += m_vRight * -InputSystem::MouseMoveX() * _fMoveSpeed;
	m_vLook += m_vUp	* -InputSystem::MouseMoveY() * _fMoveSpeed;
}